package com.android.clipps;

import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by eruipan on 2016/6/15.
 */
public class Utils {

    /***
     * 获取股票代码
     * @param content
     * @return
     */
    public static String getStockNumber(String content) {
        Pattern pattern = Pattern.compile("^[0-9]{6}$");
        Matcher matcher = pattern.matcher(content);
        StringBuffer numberBuffer = new StringBuffer();
        while(matcher.find()) {
            numberBuffer.append(matcher.group() + ",");
        }
        if (numberBuffer.length() != 0) {
            numberBuffer.replace(numberBuffer.lastIndexOf(","), numberBuffer.length(), "");
        }
        return numberBuffer.toString();
    }
}
